#include <16F877A.h>
#device adc=16

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES HS                       //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#FUSES NOPUT                    //No Power Up Timer
#FUSES NOBROWNOUT               //No brownout reset
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD                    //No EE protection
#FUSES NOWRT                    //Program memory not write protected
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES NOPROTECT                //Code not protected from reading

#use delay(clock=20000000)
#define EEPROM_SCL   PIN_C3
#define EEPROM_SDA   PIN_C4
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8,stream=PORT1)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8,stream=PORT2)
#use i2c(Master,Slow,sda=PIN_C4,scl=PIN_C3,force_hw)
#define LED PIN_A0
#define DELAY 1000


enum colors{
BLACK = 0,
RED,
GREEN,
REDGREEN,
BLUE,
REDBLUE,
GREENBLUE,
REDBLUEGREEN,
};

typedef struct leds_name{
unsigned int8 LED_D1; 
unsigned int8 LED_D2; 
unsigned int8 LED_D3; 
unsigned int8 LED_D4; 
unsigned int8 LED_D5; 
unsigned int8 LED_D6; 
unsigned int8 LED_D7; 
unsigned int8 LED_D8; 
unsigned int8 LED_D9; 
unsigned int8 LED_D10; 
unsigned int8 LED_D11; 
unsigned int8 LED_D12; 
unsigned int8 LED_D13; 
unsigned int8 LED_D14;
unsigned int8 LED_D15; 
unsigned int8 LED_D16; 
}leds_name;


void computeDelayTime(int16 *secDelay,int16 *minDelay,int16 *houDelay,BYTE gHou,BYTE gMin,BYTE gSec );
void swapint(int16 *a, int16 *b);
void sort_3( int16 order[], int16 hour, int16 min, int16 sec);
void display_frame(BYTE cmd[]);
void put_byte(BYTE cmd);
